{{extend 'layout.html'}}

<h2>{{=paper.title}}</h2>

<p id="read_abstract"><b>Abstract:</b> {{=paper.abstract}}</p>

<div class="right">
  {{if paper.file:}}
  [<a href="{{=URL(r=request,f='download',args=paper.file)}}">last submitted file</a>]{{pass}}
  {{pass}}
  {{if author:}}
  [<a href="" onclick="jQuery('#edit_paper').slideToggle();return false">edit title/abstract</a>]
  <div id="edit_paper" {{if not edit_form.errors:}}class="hidden"{{pass}}>{{=edit_form}}</div>
  {{pass}}
</div>


<h3>Communications</h3>

{{AUTHOR_MESSAGE_CODES=[x for x,y in AUTHOR_MESSAGE_TYPE]}}
{{REVIEWER_MESSAGE_CODES=[x for x,y in REVIEWER_MESSAGE_TYPE]}}
{{for m in messages:}}
{{if not (author and PRIVACY_POLICY(m.message_type)):}}
{{
if m.message_type in AUTHOR_MESSAGE_CODES:
    source='author'
elif m.message_type in REVIEWER_MESSAGE_CODES:
    source='reviewer'
else:
    source='editor'
pass
}}
<div class="source_{{=source}}">
  <div class="inner">
    <span>
      {{=MESSAGE_TYPES.get(m.message_type,'Private Communication to reviwer')}}
      from {{=source.capitalize()}}, {{=prettydate(m.created_on)}}
      {{if m.file:}}[<a href="{{=URL(r=request,f='download',args=m.file)}}">submitted file</a>]{{pass}}
    </span>
    {{if m.body:}}
    [<a href="" onclick="jQuery('#m{{=m.id}}').slideToggle();return false">read</a>]
    <p class="message" id="m{{=m.id}}">{{=m.body}}</p>
    <script>jQuery('#m{{=m.id}}').hide();</script>
    {{pass}}
  </div>
</div>
{{pass}}{{pass}}

{{=form}}

{{if add_reviewer_form:}}
<h3>Reviewers</h3>

<ul>
  {{for r in reviewers:}}
  <li>
    <a href="mailto:{{=r.email}}">{{=r.first_name}} {{r.last_name}}</a>
  </li>
  {{pass}}
</ul>
{{=add_reviewer_form}}
{{pass}}

<h3>Instructions for Authors</h3>
<a href="{{=URL(r=request,c='static',f='author.zip')}}">latex sample and style file</a>
